package com.example.activity;


import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.R;
import com.example.WalletApplication;
import com.example.util.SharePreferenceUtils;

/**
 * 欢迎页面
 */
public class WelcomeActivity extends AppCompatActivity {
    private String token;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        initView();
    }

    @SuppressLint("HandlerLeak")
    private Handler mHandler = new Handler(){
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
        }
    };

    /**
     *
     */
    private void initView(){
        token = SharePreferenceUtils.getString(WalletApplication.getInstance(),"fttToken","");

        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
//                if(TextUtils.isEmpty(token)){
//                    startActivity(new Intent(WelcomeActivity.this, WebActivity.class));
//                }else{
//                    startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
//                }


                finish();
            }
        },2500l);
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
